<template>
  <div>
    <button @click="toggle">{{ show ? '显示' : '隐藏' }}</button>
    <div
      v-if="show"
      @vue:mounted="console.log('mounted')"
      @vue:unmounted="console.log('unmounted')"
      @vue:update="console.log('update')"
    >
      显示的类容
    </div>
  </div>
</template>

<script setup>
const show = ref(false)
const toggle = () => {
  show.value = !show.value
}
</script>

<style lang="scss" scoped></style>
